@extends('layouts.back_stage')
@section('content')
    <style>
        .tableBg{padding:30px;background:#fff;}
        .pagination-box{text-align: center;box-sizing:border-box;margin-top:20px;}
        .input-item{width:200px;padding-right: 0;}
        ::-webkit-scrollbar {height: 8px;}
        .el-table__footer-wrapper tbody td, .el-table__header-wrapper tbody td{color:red;}
        .el-select .el-input .el-select__caret.el-input__icon{line-height:22px;}
        .el-table--mini.shopDetail th{padding:0;}
        .el-table--mini.shopGirard th{padding:0;}
        .el-table--mini.shopHouse th{padding:0;}
        .el-table tr:hover>td{background:initial !important;}
        .el-table tr.current-row>td{background:initial !important;}
        [v-cloak] {display: none;}
        .shopGirard.el-table--mini td, .el-table--mini th{padding:0 !important;}
        .HuishopGirard.el-table--mini td, .el-table--mini th{padding:0 !important;}
        .HuishopGirard .has-gutter{display:none !important;}
        .shopHouse.el-table--mini td, .el-table--mini th{padding:0 !important;}
        .HuishopHouse.el-table--mini td, .el-table--mini th{padding:0 !important;}
        .HuishopHouse .has-gutter{display:none !important;}
    </style>
    <div class="container">
        <div style="padding:20px 20px 20px 0;overflow:hidden;"><h3 style="float:left;">库存综合查询</h3></div>
        <!-- 主体-->
        <div class="page-body">
            <div class="row app" id="shopInfos" v-cloak>
                <div class="col-md-12 row row-table-box">
                    <div class="tableBg" style="margin-top:10px;">
                        <el-tabs v-model="activeName2" type="border-card" @tab-click="handleClick">
                            {{--<el-tab-pane label="按店汇总" name="first">--}}
                                {{--<div class="row" style="margin-top:10px;padding:6px 30px;min-height:65px;background:#fff;">--}}
                                    {{--<label>公司：</label>--}}
                                    {{--<el-select v-model="company_id1" filterable placeholder="请选择公司" size="small" @change="change1" :disabled="comDis" style="width:200px;">--}}
                                        {{--<el-option v-for="item in options1" :key="item.id" :label="item.company_name" :value="item.id"></el-option>--}}
                                    {{--</el-select>--}}
                                    {{--<label>店铺：</label>--}}
                                    {{--<el-select v-model="shop_id" filterable placeholder="请选择店铺" size="small" style="width:200px;">--}}
                                        {{--<el-option v-for="item in options2" :key="item.id" :label="item.shop_name" :value="item.id"></el-option>--}}
                                    {{--</el-select>--}}
                                    {{--<el-button type="primary" size="small" @click="grabble1('reset')">搜索</el-button>--}}
                                    {{--<el-button type="primary" size="small" @click="reset1('reset')">重置</el-button>--}}
                                {{--</div>--}}
                                {{--<el-table :data="shopInfo" max-height="510" size="mini" style="width: 100%;" border v-loading="loading1" :summary-method="getSummaries1" show-summary>--}}
                                    {{--<el-table-column prop="loop" label="序号" width="50" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="customer_name" label="店铺名称" min-width="160" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="existing_nums" label="现有库存量/件" width="100" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="user_nums" label="可用库存量/件" width="100" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="occupied_num" label="占用库存量/件" width="100" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="on_way_num" label="在途库存量/件" width="100" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="count_nums" label="总库存量/件" width="100" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="existing_prices" label="现有库存零售额/元" align="right" width="130" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="user_price" label="可用库存零售额/元" align="right" width="140" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="occupied_price" label="占用库存零售额/元" align="right" width="140" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="on_way_price" label="在途库存零售额/元" align="right" width="140" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="count_price" label="总库存零售额/元" align="right" width="140" :resizable='false'></el-table-column>--}}
                                {{--</el-table>--}}
                                {{--<div class="pagination-box">--}}
                                    {{--<el-pagination @size-change="handleSizeChange1" :page-sizes="[10,50,100,200]" :page-size="10" @current-change="changePageSkip1" :current-page.sync="currentPage1" :total="total1" layout="sizes,prev, pager, next" background></el-pagination>--}}
                                {{--</div>--}}
                            {{--</el-tab-pane>--}}
                            <el-tab-pane label="按款汇总" name="second">
                                <div class="row" style="margin-top:10px;padding:6px 30px;min-height:65px;background:#fff;">
                                    <label>公司：</label>
                                    <el-select v-model="company_id2" filterable placeholder="请选择公司" size="small" @change="change2" :disabled="comDis" style="width:200px;">
                                        <el-option v-for="item in options1" :key="item.id" :label="item.company_name" :value="item.id"></el-option>
                                    </el-select>
                                    <label>品牌：</label>
                                    <el-select v-model="brand" filterable placeholder="请选择品牌" size="small" style="width:200px;">
                                        <el-option v-for="item in options3" :key="item.id" :label="item.brand_name" :value="item.id"></el-option>
                                    </el-select>
                                    <label>款号：</label>
                                    <el-autocomplete v-model.trim="girard" class="input-item" :trigger-on-focus="false" :fetch-suggestions="querySearchAsync2" size="small" placeholder="请输入款号" clearable></el-autocomplete>
                                    <el-button type="primary" size="small" @click="grabble2('reset')">搜索</el-button>
                                    <el-button type="primary" size="small" @click="reset2('reset')">重置</el-button>
                                </div>
                                <el-table :data="brandInfo" max-height="510"  size="mini" style="width: 100%;" border v-loading="loading2" :summary-method="getSummaries2" show-summary>
                                    <el-table-column prop="loop" label="序号" width="50" :resizable='false'></el-table-column>
                                    <el-table-column prop="brand" label="品牌" width="120" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_3" label="小类" width="110" :resizable='false'></el-table-column>
                                    <el-table-column prop="girard" label="款号" width="110" :resizable='false'></el-table-column>
                                    <el-table-column prop="existing_nums" label="现有库存量/件" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="user_nums" label="可用库存量/件" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="occupied_num" label="占用库存量/件" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="on_way_num" label="在途库存量/件" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="count_nums" label="总库存量/件" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="existing_prices" label="现有库存零售额/元" align="right" width="130" :resizable='false'></el-table-column>
                                    <el-table-column prop="user_price" label="可用库存零售额/元" align="right" width="140" :resizable='false'></el-table-column>
                                    <el-table-column prop="occupied_price" label="占用库存零售额/元" align="right" width="140" :resizable='false'></el-table-column>
                                    <el-table-column prop="on_way_price" label="在途库存零售额/元" align="right" width="140" :resizable='false'></el-table-column>
                                    <el-table-column prop="count_price" label="总库存零售额/元" align="right" width="140" :resizable='false'></el-table-column>
                                    <el-table-column prop="year" label="年份" width="" :resizable='false'></el-table-column>
                                    <el-table-column prop="quarter" label="季节" width="60" :resizable='false'></el-table-column>
                                    <el-table-column prop="retail_price" label="零售价" width="120" :resizable='false'></el-table-column>
                                </el-table>
                                <div class="pagination-box">
                                    <el-pagination @size-change="handleSizeChange2" :page-sizes="[10,50,100,200]" :page-size="10" @current-change="changePageSkip2" :current-page.sync="currentPage2" :total="total2" layout="sizes,prev, pager, next" background></el-pagination>
                                </div>
                            </el-tab-pane>
                            <el-tab-pane label="按仓库汇总" name="third">
                                <div class="row" style="margin-top:10px;padding:6px 30px;min-height:65px;background:#fff;">
                                    <label>公司：</label>
                                    <el-select v-model="company_id3" filterable placeholder="请选择公司" size="small" @change="change3" :disabled="comDis" style="width:200px;">
                                        <el-option v-for="item in options1" :key="item.id" :label="item.company_name" :value="item.id"></el-option>
                                    </el-select>
                                    <label>仓库：</label>
                                    <el-select v-model="factory_type_id" filterable placeholder="请选择仓库" size="small" style="width:200px;">
                                        <el-option v-for="item in options4" :key="item.id" :label="item.type" :value="item.id"></el-option>
                                    </el-select>
                                    <el-button type="primary" size="small" @click="grabble3('reset')">搜索</el-button>
                                    <el-button type="primary" size="small" @click="reset3('reset')">重置</el-button>
                                </div>
                                <el-table :data="warehouseInfo" max-height="510"  size="mini" style="width: 100%;" border v-loading="loading3" :summary-method="getSummaries3" show-summary>

                                    <el-table-column prop="loop" label="序号" width="50" :resizable='false'></el-table-column>
                                    <el-table-column prop="factory" label="仓库名称" min-width="160" :resizable='false'></el-table-column>
                                    <el-table-column prop="existing_nums" label="现有库存量/件" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="user_nums" label="可用库存量/件" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="occupied_num" label="占用库存量/件" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="on_way_num" label="在途库存量/件" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="count_nums" label="总库存量/件" width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="existing_prices" label="现有库存零售额/元" align="right" width="130" :resizable='false'></el-table-column>
                                    <el-table-column prop="user_price" label="可用库存零售额/元" align="right" width="140" :resizable='false'></el-table-column>
                                    <el-table-column prop="occupied_price" label="占用库存零售额/元" align="right" width="140" :resizable='false'></el-table-column>
                                    <el-table-column prop="on_way_price" label="在途库存零售额/元" align="right" width="140" :resizable='false'></el-table-column>
                                    <el-table-column prop="count_price" label="总库存零售额/元" align="right" width="140" :resizable='false'></el-table-column>
                                </el-table>
                                <div class="pagination-box">
                                    <el-pagination @size-change="handleSizeChange3" :page-sizes="[10,50,100,200]" :page-size="10" @current-change="changePageSkip3" :current-page.sync="currentPage3" :total="total3" layout="sizes,prev, pager, next" background></el-pagination>
                                </div>
                            </el-tab-pane>
                            {{--<el-tab-pane label="按店明细" name="fourth">--}}
                                {{--<div class="row" style="margin-top:10px;padding:6px 30px;min-height:65px;background:#fff;">--}}
                                    {{--<label>公司：</label>--}}
                                    {{--<el-select v-model="company_id4" filterable placeholder="请选择公司" size="small" @change="change4" :disabled="comDis" style="width:200px;">--}}
                                        {{--<el-option v-for="item in options1" :key="item.id" :label="item.company_name" :value="item.id"></el-option>--}}
                                    {{--</el-select>--}}
                                    {{--<label>店铺：</label>--}}
                                    {{--<el-select v-model="shop_id4" filterable placeholder="请选择店铺" size="small" style="width:200px;">--}}
                                        {{--<el-option v-for="item in options2" :key="item.id" :label="item.shop_name" :value="item.id"></el-option>--}}
                                    {{--</el-select>--}}
                                    {{--<el-button type="primary" size="small" @click="grabble4('reset')">搜索</el-button>--}}
                                    {{--<el-button type="primary" size="small" @click="reset4('reset')">重置</el-button>--}}
                                {{--</div>--}}
                                {{--<el-table :data="shopDetail" class="shopDetail" max-height="auto" size="mini" style="width: 100%;" border v-loading="loading4" :span-method="objectSpanMethod4" :row-style="rowClass">--}}
                                    {{--<el-table-column prop="shop" label="店铺" width="140" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="brand" label="品牌" width="100" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="cate_3" label="小类" width="100" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="girard" label="款号" width="100" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="color" label="颜色" width="70" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="type" label="库存类别/件" width="90" :resizable='false'></el-table-column>--}}

                                    {{--<el-table-column v-for="item in sizeGr"  :label="item.key76" width="70" :resizable='false'>--}}
                                        {{--<el-table-column :label="item.key75" width="70" :resizable='false'>--}}
                                            {{--<el-table-column :label="item.key79" width="70" :resizable='false'>--}}
                                                {{--<el-table-column :label="item.key154" width="70" :resizable='false'>--}}
                                                    {{--<el-table-column :label="item.key146" width="70" :resizable='false'>--}}
                                                        {{--<el-table-column :label="item.key161" width="70" :resizable='false'>--}}
                                                            {{--<el-table-column :label="item.key77" width="70" :resizable='false'>--}}
                                                                {{--<el-table-column :prop="item.key_0" :label="item.key140" width="70" :resizable='false'></el-table-column>--}}
                                                            {{--</el-table-column>--}}
                                                        {{--</el-table-column>--}}
                                                    {{--</el-table-column>--}}
                                                {{--</el-table-column>--}}
                                            {{--</el-table-column>--}}
                                        {{--</el-table-column>--}}
                                    {{--</el-table-column>--}}
                                    {{--<el-table-column prop="year" width="55" label="年份" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="season" width="55" label="季节" :resizable='false'></el-table-column>--}}
                                    {{--<el-table-column prop="cardCount" label="零售价/元" align="right" min-width="120" :resizable='false'></el-table-column>--}}
                                {{--</el-table>--}}
                            {{--</el-tab-pane>--}}
                            <el-tab-pane label="按款明细" name="fifth">
                                <div class="row" style="margin-top:10px;padding:6px 30px;min-height:65px;background:#fff;">
                                    <label>公司：</label>
                                    <el-select v-model="company_id5" filterable placeholder="请选择公司" size="small" @change="change5" :disabled="comDis" style="width:200px;">
                                        <el-option v-for="item in options1" :key="item.id" :label="item.company_name" :value="item.id"></el-option>
                                    </el-select>
                                    <label>品牌：</label>
                                    <el-select v-model="brand5" filterable placeholder="请选择品牌" size="small" style="width:200px;">
                                        <el-option v-for="item in options5" :key="item.id" :label="item.brand_name" :value="item.id"></el-option>
                                    </el-select>
                                    <label>款号：</label>
                                    <el-autocomplete v-model.trim="girard5" class="input-item" :trigger-on-focus="false" :fetch-suggestions="querySearchAsync5" size="small" placeholder="请输入款号" clearable></el-autocomplete>
                                    <el-button type="primary" size="small" @click="grabble5('reset')">搜索</el-button>
                                    <el-button type="primary" size="small" @click="reset5('reset')">重置</el-button>
                                </div>
                                <el-table :data="shopGirard" class="shopGirard" max-height="685" size="mini" style="width: 100%;" border v-loading="loading5" :span-method="objectSpanMethod5" :row-style="rowClass5">
                                    <el-table-column prop="girard" label="款号" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="brand" label="品牌" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_3" label="小类" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="color" label="颜色" min-width="70" :resizable='false'></el-table-column>
                                    <el-table-column prop="type" label="库存类别/件" width="90" :resizable='false'></el-table-column>

                                    <el-table-column v-for="item in sizeGr"  :label="item.key76" width="70" :resizable='false'>
                                        <el-table-column :label="item.key75" width="70" :resizable='false'>
                                            <el-table-column :label="item.key79" width="70" :resizable='false'>
                                                <el-table-column :label="item.key154" width="70" :resizable='false'>
                                                    <el-table-column :label="item.key146" width="70" :resizable='false'>
                                                        <el-table-column :label="item.key161" width="70" :resizable='false'>
                                                            <el-table-column :label="item.key77" width="70" :resizable='false'>
                                                                <el-table-column :prop="item.key_0" :label="item.key140" width="70" :resizable='false'></el-table-column>
                                                            </el-table-column>
                                                        </el-table-column>
                                                    </el-table-column>
                                                </el-table-column>
                                            </el-table-column>
                                        </el-table-column>
                                    </el-table-column>
                                    <el-table-column prop="year" width="55" label="年份" :resizable='false'></el-table-column>
                                    <el-table-column prop="quarter" width="55" label="季节" :resizable='false'></el-table-column>
                                    <el-table-column prop="retail_price" label="零售价/元" align="right" width="120" :resizable='false'></el-table-column>
                                </el-table>
                                <div class="pagination-box">
                                    <el-pagination @size-change="handleSizeChange5" :page-sizes="[10,30,50]" :page-size="10" @current-change="changePageSkip5" :current-page.sync="currentPage5" :total="total5" layout="sizes,prev, pager, next" background></el-pagination>
                                </div>
                                <el-table :data="huiZong5" class="HuishopGirard" size="mini" style="width: 100%;margin-top:20px;" border :span-method="huiZongMethod5">
                                    <el-table-column prop="girard" label="" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="brand" label="" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_3" label="" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="color" label="" min-width="70" :resizable='false'></el-table-column>
                                    <el-table-column prop="type" label="" width="90" :resizable='false'></el-table-column>
                                    <el-table-column v-for="item in sizeGr" :prop="item.key_0" label="" width="70" :resizable='false'></el-table-column>
                                    <el-table-column prop="year" width="55" label="" :resizable='false'></el-table-column>
                                    <el-table-column prop="quarter" width="55" label="" :resizable='false'></el-table-column>
                                    <el-table-column prop="retail_price" label="" align="right" width="120" :resizable='false'></el-table-column>
                                </el-table>
                            </el-tab-pane>
                            <el-tab-pane label="按仓库明细" name="sixth">
                                <div class="row" style="margin-top:10px;padding:6px 30px;min-height:65px;background:#fff;">
                                    <label>公司：</label>
                                    <el-select v-model="company_id6" filterable placeholder="请选择公司" size="small" @change="change6" :disabled="comDis" style="width:200px;">
                                        <el-option v-for="item in options1" :key="item.id" :label="item.company_name" :value="item.id"></el-option>
                                    </el-select>
                                    <label>仓库：</label>
                                    <el-select v-model="factory_type_id6" filterable placeholder="请选择仓库" size="small" style="width:200px;">
                                        <el-option v-for="item in options6" :key="item.id" :label="item.type" :value="item.id"></el-option>
                                    </el-select>
                                    <el-button type="primary" size="small" @click="grabble6('reset')">搜索</el-button>
                                    <el-button type="primary" size="small" @click="reset6('reset')">重置</el-button>
                                </div>
                                <el-table :data="shopHouse" class="shopHouse" max-height="685" size="mini" style="width: 100%;" border v-loading="loading6" :span-method="objectSpanMethod6" :row-style="rowClass6">
                                    <el-table-column prop="factory_type" label="仓库" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="brand" label="品牌" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_3" label="小类" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="girard" label="款号" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="color" label="颜色" min-width="70" :resizable='false'></el-table-column>
                                    <el-table-column prop="type" label="库存类别/件" width="90" :resizable='false'></el-table-column>

                                    <el-table-column v-for="item in sizeGr"  :label="item.key76" width="70" :resizable='false'>
                                        <el-table-column :label="item.key75" width="70" :resizable='false'>
                                            <el-table-column :label="item.key79" width="70" :resizable='false'>
                                                <el-table-column :label="item.key154" width="70" :resizable='false'>
                                                    <el-table-column :label="item.key146" width="70" :resizable='false'>
                                                        <el-table-column :label="item.key161" width="70" :resizable='false'>
                                                            <el-table-column :label="item.key77" width="70" :resizable='false'>
                                                                <el-table-column :prop="item.key_0" :label="item.key140" width="70" :resizable='false'></el-table-column>
                                                            </el-table-column>
                                                        </el-table-column>
                                                    </el-table-column>
                                                </el-table-column>
                                            </el-table-column>
                                        </el-table-column>
                                    </el-table-column>
                                    <el-table-column prop="year" width="55" label="年份" :resizable='false'></el-table-column>
                                    <el-table-column prop="quarter" width="55" label="季节" :resizable='false'></el-table-column>
                                    <el-table-column prop="retail_price" label="零售价/元" align="right" width="120" :resizable='false'></el-table-column>
                                </el-table>
                                <div class="pagination-box">
                                    <el-pagination @size-change="handleSizeChange6" :page-sizes="[10,30,50]" :page-size="10" @current-change="changePageSkip6" :current-page.sync="currentPage6" :total="total6" layout="sizes,prev, pager, next" background></el-pagination>
                                </div>
                                <el-table :data="huiZong6" class="HuishopHouse" size="mini" style="width: 100%;margin-top:20px;" border :span-method="huiZongMethod6">
                                    <el-table-column prop="factory_type" label="" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="brand" label="" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="cate_3" label="" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="girard" label="" min-width="100" :resizable='false'></el-table-column>
                                    <el-table-column prop="color" label="" min-width="70" :resizable='false'></el-table-column>
                                    <el-table-column prop="type" label="" width="90" :resizable='false'></el-table-column>
                                    <el-table-column v-for="item in sizeGr" :prop="item.key_0" label="" width="70" :resizable='false'></el-table-column>
                                    <el-table-column prop="year" width="55" label="" :resizable='false'></el-table-column>
                                    <el-table-column prop="quarter" width="55" label="" :resizable='false'></el-table-column>
                                    <el-table-column prop="retail_price" label="" align="right" width="120" :resizable='false'></el-table-column>
                                </el-table>
                            </el-tab-pane>
                        </el-tabs>
                    </div>
                </div>
            </div>
        </div>
        <!-- /主体-->
    </div>
    <script>
        new Vue({
            el: '#shopInfos',
            data:{
                sizeGr:[],//尺码
                getDate:false,
                activeName2: 'second',
                girardNum:'',//款号种类合计

                shopInfo:[], //按店汇总
                total1:1,  //table总条数
                page1:10,//每页多少条
                currentPage1:1, //table当前页数
                company_id1:'',//公司
                shop_id:'',//店铺
                options1: [], //公司
                options2: [], //店铺
                comDis:false,//公司选择状态
                loading1:false,//缓冲

                now_stock1:'',//现有库存量
                now_stock_price1:'',//现有库存零售额
                available_num1:'',//可用库存量
                available_price1:'',//可用库存零售额
                occupy_num1:'',//占用库存量
                occupy_price1:'',//占用库存零售额
                way_num1:'',//在途库存量
                way_price1:'',//在途库存零售额
                total_num1:'',//总库存量
                total_price1:'',//总库存零售额



                brandInfo:[], //按款汇总
                total2:1,  //table总条数
                page2:10,//每页多少条
                currentPage2:1, //table当前页数
                company_id2:'',//公司
                brand:'',//品牌
                girard:'',//款号
                options3: [], //品牌
                loading2:false,//缓冲

                now_stock2:'',//现有库存量
                now_stock_price2:'',//现有库存零售额
                available_num2:'',//可用库存量
                available_price2:'',//可用库存零售额
                occupy_num2:'',//占用库存量
                occupy_price2:'',//占用库存零售额
                way_num2:'',//在途库存量
                way_price2:'',//在途库存零售额
                total_num2:'',//总库存量
                total_price2:'',//总库存零售额


                warehouseInfo:[], //按仓库汇总
                total3:1,  //table总条数
                page3:10,//每页多少条
                currentPage3:1, //table当前页数
                company_id3:'',//公司
                factory_type_id:'',//仓库
                options4: [], //仓库
                loading3:false,//缓冲

                now_stock3:'',//现有库存量
                now_stock_price3:'',//现有库存零售额
                available_num3:'',//可用库存量
                available_price3:'',//可用库存零售额
                occupy_num3:'',//占用库存量
                occupy_price3:'',//占用库存零售额
                way_num3:'',//在途库存量
                way_price3:'',//在途库存零售额
                total_num3:'',//总库存量
                total_price3:'',//总库存零售额

                shopDetail:[], //按店明细
                company_id4:'',//公司
                shop_id4:'',//店铺
                loading4:false,//缓冲

                shopGirard:[], //按款明细
                total5:1,  //table总条数
                page5:10,//每页多少条
                currentPage5:1, //table当前页数
                company_id5:'',//公司
                brand5:'',//品牌
                options5: [],
                girard5:'',//款号
                loading5:false,//缓冲
                spanArr5:[],//合并店铺数组
                huiZong5:[],//汇总合计

                shopHouse:[], //按仓库明细
                total6:1,  //table总条数
                page6:10,//每页多少条
                currentPage6:1, //table当前页数
                company_id6:'',//公司
                options6: [],
                factory_type_id6:'',//仓库
                loading6:false,//缓冲
                spanArr6:[],//合并店铺数组
                huiZong6:[],//汇总合计

                spanArr:[],//合并店铺数组
                idArr:[],//颜色改变id数组
            },
            mounted(){
                this.baseInfo();
                this.common();
            },
            methods:{
                /*尺码数据*/
                common(){
                    var that=this;
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/sizeGroupHead',
                        data: {
                            type:1,
                        },
                        success: function (data) {
                            //console.log(data);
                            if(data.result.success){
                                that.sizeGr=data.content.vertical;
                            }else{
                                that.$notify.error({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                });
                            }
                        }
                    });
                },
                /*基本信息*/
                baseInfo(){
                    var that=this;
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/analysis-infos',
                        data: {
                            company:-1,
                        },
                        success: function (data) {
                            //console.log(data);
                            if(data.result.success){
                                that.company_id1=data.content.company_id;
                                that.company_id2=data.content.company_id;
                                that.company_id3=data.content.company_id;
                                that.company_id4=data.content.company_id;
                                that.company_id5=data.content.company_id;
                                that.company_id6=data.content.company_id;
                                that.options1 = data.content.data;
//                                if(data.content.company_id==1){
//                                    that.comDis=false;
//                                }else{
//                                    that.comDis=true;
//                                }
//                                that.change1(data.content.company_id);
                                that.change2(data.content.company_id);
                                that.change3(data.content.company_id);
//                                that.change4(data.content.company_id);
                                that.change5(data.content.company_id);
                                that.change6(data.content.company_id);
                                that.grabble2();
                            }else{
                                that.$notify.error({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                });
                            }
                        }
                    });
                },
//   --------------------------
                /*按店汇总列表*/
//                grabble1(type){
//                    var that = this;
////                    that.loading1=true;
//                    let skip;
//                    if(type == 'reset'){
//                        skip = 0;
//                    }else{
//                        skip = that.currentPage1-1;
//                    }
//                    $.ajax({
//                        headers: {
//                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
//                        },
//                        type: 'post',
//                        url: '/distribution/storage-analysis',
//                        data: {
//                            skip:skip,
//                            page1:that.page1,
//                            company_id:that.company_id1,
//                            customer_id:that.shop_id,
//                            type:1,
//                        },
//                        success: function (data) {
//                            //console.log(data);
//                            if(data.result.success){
//                                that.existing_nums1=data.content.total.now_stock;//现有库存量
//                                that.existing_prices1=data.content.total.now_stock_price;//现有库存零售额
//                                that.available_num1=data.content.total.available_num;//可用库存量
//                                that.available_price1=data.content.total.available_price;//可用库存零售额
//                                that.occupied_nums1=data.content.total.occupy_num;//占用库存量
//                                that.occupied_prices1=data.content.total.occupy_price;//占用库存零售额
//                                that.on_way_nums1=data.content.total.way_num;//在途库存量
//                                that.on_way_prices1=data.content.total.way_price;//在途库存零售额
//                                that.total_num1=data.content.total.total_num;//总库存量
//                                that.total_price1=data.content.total.total_price;//总库存零售额
//                                var opt=[];
//                                let i = 0;
//                                for(var value of data.content.data){
//                                    i++;
//                                    opt.push({
//                                        'loop':i+(Number(that.page1)*skip),
//                                        'customer_name':value.customer_name,
//                                        'existing_nums':value.now_stock, //现有
//                                        'user_nums':value.available_num, //可用
//                                        'occupied_num':value.occupy_num,//占用
//                                        'on_way_num':value.way_num,//在途
//                                        'count_nums':value.total_num, //总
//
//                                        'existing_prices':(parseFloat(value.now_stock_price)).toFixed(2),//现有
//                                        'user_price':parseFloat(value.available_price).toFixed(2), //可用
//                                        'occupied_price':(parseFloat(value.occupy_price)).toFixed(2),//占用
//                                        'on_way_price':(parseFloat(value.way_price)).toFixed(2),//在途
//                                        'count_price':parseFloat(value.total_price).toFixed(2), //总
//                                    })
//                                }
//                                that.shopInfo = opt;
//                                that.currentPage1 = data.content.skip;
//                                that.total1 = data.content.shop_infos_count;
//                                that.loading1=false
//                            }else{
//                                that.$notify({
//                                    title: '提示',
//                                    message: data.result.errorMsg,
//                                    duration: 0
//                                });
//                            }
//                        }
//                    });
//                },
                /*公司改变出店铺*/
//                change1(val){
//                    this.company_id1 = val;
//                    this.shop_id='';
//                    var that=this;
//                    if (this.company_id1 != '') {
//                        $.ajax({
//                            headers: {
//                                'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
//                            },
//                            type: 'post',
//                            url: '/distribution/analysis-infos',
//                            data: {
//                                company_id:that.company_id1,
//                            },
//                            success: function (data) {
//                                if(data.result.success){
//                                    that.options2 = data.content.data;
//                                }else{
//                                    that.$notify.error({
//                                        title: '提示',
//                                        message: data.result.errorMsg,
//                                    });
//                                }
//                            }
//                        });
//                    }else{
//                        that.options2 =[];
//                    }
//
//                },
                /*按店汇总重置*/
//                reset1(){
//                    this.shop_id='';
//                    this.grabble1('reset');
//                },
                /*按店汇总每页条数*/
//                handleSizeChange1(val) {
//                    this.page1=val;
//                    this.grabble1('reset');
//                    //console.log(`每页 ${val} 条`);
//                },
                /*按店汇总分页*/
//                changePageSkip1(val){
//                    //console.log(val);
//                    this.currentPage1 = val;
//                    this.grabble1();
//                },
                /*按店汇总合计*/
//                getSummaries1(param){
//                    var that=this;
//                    const { columns, data } = param;
//                    const sums = [];
//                    columns.forEach((column, index) => {
//                        if (index === 0) {
//                            sums[index] = '合计';
//                            return;
//                        }
//                        switch (column.property) {
//                            case 'existing_nums':
//                                sums[index] = that.existing_nums1;
//                                break;
//                            case 'user_nums':
//                                sums[index] =(parseFloat(that.existing_nums1)-parseFloat(that.occupied_nums1));
//                                break;
//                            case 'occupied_num':
//                                sums[index] = that.occupied_nums1;
//                                break;
//                            case 'on_way_num':
//                                sums[index] = that.on_way_nums1;
//                                break;
//                            case 'count_nums':
//                                sums[index] =(parseFloat(that.existing_nums1)+parseFloat(that.on_way_nums1));
//                                break;
//                            case 'existing_prices':
//                                sums[index] =parseFloat(that.existing_prices1).toFixed(2);
//                                break;
//                            case 'user_price':
//                                sums[index] =(parseFloat(that.existing_prices1)-parseFloat(that.occupied_prices1)).toFixed(2);
//                                break;
//                            case 'occupied_price':
//                                sums[index] =parseFloat(that.occupied_prices1).toFixed(2);
//                                break;
//                            case 'on_way_price':
//                                sums[index] =parseFloat(that.on_way_prices1).toFixed(2);
//                                break;
//                            case 'count_price':
//                                sums[index] =(parseFloat(that.existing_prices1)+parseFloat(that.on_way_prices1)).toFixed(2);
//                                break;
//                            default:
//                                break;
//                        }
//                    });
//                    return sums
//                },
//------------------------------
                /*按款汇总列表*/
                grabble2(type){
                    var that = this;
                    that.loading2=true;
                    let skip;
                    if(type == 'reset'){
                        skip = 0;
                    }else{
                        skip = that.currentPage2-1;
                    }
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/storage-analysis',
                        data: {
                            skip:skip,
                            page2:that.page2,
                            company_id:that.company_id2,
                            brand:that.brand,
                            girard:that.girard,
                            type:2,
                        },
                        success: function (data) {
                            //console.log(data);
                            if(data.result.success){
                                that.now_stock2=data.content.total.now_stock;//现有库存量
                                that.now_stock_price2=data.content.total.now_stock_price;//现有库存零售额
                                that.available_num2=data.content.total.available_num;//可用库存量
                                that.available_price2=data.content.total.available_price;//可用库存零售额
                                that.occupy_num2=data.content.total.occupy_num;//占用库存量
                                that.occupy_price2=data.content.total.occupy_price;//占用库存零售额
                                that.way_num2=data.content.total.way_num;//在途库存量
                                that.way_price2=data.content.total.way_price;//在途库存零售额
                                that.total_num2=data.content.total.total_num;//总库存量
                                that.total_price2=data.content.total.total_price;//总库存零售额

                                var opt=[];
                                let girardArr=[];
                                let i = 0;
                                for(var value of data.content.data){
                                    if(girardArr.indexOf(value.girard)==-1){
                                        girardArr.push(value.girard)
                                    };
                                    i++;
                                    opt.push({
                                        'loop':i+(Number(that.page2)*skip),
                                        'brand':value.brand,
                                        'cate_3':value.cate_3,
                                        'girard':value.girard,

                                        'existing_nums':value.now_stock, //现有
                                        'user_nums':value.available_num, //可用
                                        'occupied_num':value.occupy_num,//占用
                                        'on_way_num':value.way_num,//在途
                                        'count_nums':value.total_num, //总

                                        'existing_prices':(parseFloat(value.now_stock_price)).toFixed(2),//现有
                                        'user_price':parseFloat(value.available_price).toFixed(2), //可用
                                        'occupied_price':(parseFloat(value.occupy_price)).toFixed(2),//占用
                                        'on_way_price':(parseFloat(value.way_price)).toFixed(2),//在途
                                        'count_price':parseFloat(value.total_price).toFixed(2), //总

                                        'year':value.year,
                                        'quarter':value.quarter,
                                        'retail_price':value.retail_price,
                                    })
                                }
                                that.girardNum=girardArr.length;
                                that.brandInfo = opt;
                                that.currentPage2 = data.content.skip;
                                that.total2 = data.content.total_count;
                                that.loading2=false
                            }else{
                                that.$notify({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                    duration: 0
                                });
                            }
                        }
                    });
                },
                /*远程搜索*/
                querySearchAsync2(queryString, cb) {
                    var that=this;
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/designwarehouse-girards',
                        data: {
                            girard:queryString
                        },
                        success: function (data) {
                            if(data.result.success){
                                var results=[];
                                for(var i=0;i<data.content.length;i++){
                                    results.push({
                                        'value':data.content[i]
                                    })
                                }
                                clearTimeout(this.timeout);
                                this.timeout = setTimeout(() => {
                                    cb(results);
                                }, 1000 * Math.random());
                                $(".el-autocomplete-suggestion.el-popper.is-loading").show();
                            }else{
                                that.$notify.error({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                });
                            }
                        }
                    });
                },
                /*公司改变出品牌*/
                change2(val){
                    this.company_id2 = val;
                    this.brand='';
                    var that=this;
                    if (this.company_id2 != '') {
                        $.ajax({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                            },
                            type: 'post',
                            url: '/distribution/analysis-infos',
                            data: {
                                company_id:that.company_id2,
                                brand:-1,
                            },
                            success: function (data) {
                               // console.log(data);
                                if(data.result.success){
                                    that.options3 = data.content.data;
                                }else{
                                    that.$notify.error({
                                        title: '提示',
                                        message: data.result.errorMsg,
                                    });
                                }
                            }
                        });
                    }else{
                        that.options3 =[];
                    }

                },
                /*按款汇总重置*/
                reset2(){
                    this.brand='';
                    this.girard='';
                    this.grabble2('reset');
                },
                /*按款汇总每页条数*/
                handleSizeChange2(val) {
                    this.page2=val;
                    this.grabble2('reset');
                    //console.log(`每页 ${val} 条`);
                },
                /*按款汇总分页*/
                changePageSkip2(val){
                    //console.log(val);
                    this.currentPage2 = val;
                    this.grabble2();
                },
                /*按款汇总合计*/
                getSummaries2(param){
                    var that = this;
                    const { columns, data } = param;
                    const sums = [];
                    columns.forEach((column, index) => {
                        if (index === 0) {
                            sums[index] = '合计';
                            return;
                        }
                        switch (column.property) {
                            case 'girard':
                                sums[index] = that.girardNum;
                                break;
                            case 'existing_nums':
                                sums[index] = that.now_stock2;
                                break;
                            case 'user_nums':
                                sums[index] =that.available_num2;
                                break;
                            case 'occupied_num':
                                sums[index] = that.occupy_num2;
                                break;
                            case 'on_way_num':
                                sums[index] = that.way_num2;
                                break;
                            case 'count_nums':
                                sums[index] =that.total_num2;
                                break;
                            case 'existing_prices':
                                sums[index] =parseFloat(that.now_stock_price2).toFixed(2);
                                break;
                            case 'user_price':
                                sums[index] =parseFloat(that.available_price2).toFixed(2);
                                break;
                            case 'occupied_price':
                                sums[index] =parseFloat(that.occupy_price2).toFixed(2);
                                break;
                            case 'on_way_price':
                                sums[index] =parseFloat(that.way_price2).toFixed(2);
                                break;
                            case 'count_price':
                                sums[index] =parseFloat(that.total_price2).toFixed(2);
                                break;
                            default:
                                break;
                        }
                    });
                    return sums
                },
//---------------------------------
                /*按仓库汇总列表*/
                grabble3(type){
                    var that = this;
                    that.loading3=true;
                    let skip;
                    if(type == 'reset'){
                        skip = 0;
                    }else{
                        skip = that.currentPage3-1;
                    }
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/storage-analysis',
                        data: {
                            skip:skip,
                            page3:that.page3,
                            company_id:that.company_id3,
                            factory_type_id:that.factory_type_id,
                            type:3,
                        },
                        success: function (data) {
                            //console.log(data);
                            if(data.result.success){
                                that.now_stock3=data.content.total.now_stock;//现有库存量
                                that.now_stock_price3=data.content.total.now_stock_price;//现有库存零售额
                                that.available_num3=data.content.total.available_num;//可用库存量
                                that.available_price3=data.content.total.available_price;//可用库存零售额
                                that.occupy_num3=data.content.total.occupy_num;//占用库存量
                                that.occupy_price3=data.content.total.occupy_price;//占用库存零售额
                                that.way_num3=data.content.total.way_num;//在途库存量
                                that.way_price3=data.content.total.way_price;//在途库存零售额
                                that.total_num3=data.content.total.total_num;//总库存量
                                that.total_price3=data.content.total.total_price;//总库存零售额
                                var opt=[];
                                let i = 0;
                                for(var value of data.content.data){
                                    i++;
                                    opt.push({
                                        'loop':i+(Number(that.page3)*skip),
                                        'factory':value.factory_type,
                                        'existing_nums':value.now_stock, //现有
                                        'user_nums':value.available_num, //可用
                                        'occupied_num':value.occupy_num,//占用
                                        'on_way_num':value.way_num,//在途
                                        'count_nums':value.total_num, //总

                                        'existing_prices':(parseFloat(value.now_stock_price)).toFixed(2),//现有
                                        'user_price':parseFloat(value.available_price).toFixed(2), //可用
                                        'occupied_price':(parseFloat(value.occupy_price)).toFixed(2),//占用
                                        'on_way_price':(parseFloat(value.way_price)).toFixed(2),//在途
                                        'count_price':parseFloat(value.total_price).toFixed(2), //总
                                    })
                                }
                                that.warehouseInfo = opt;
                                that.currentPage3 = data.content.skip;
                                that.total3 = data.content.total_count;
                                that.loading3=false
                            }else{
                                that.$notify({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                    duration: 0
                                });
                            }
                        }
                    });
                },
                /*公司改变出仓库*/
                change3(val){
                    this.company_id3 = val;
                    this.factory_type_id='';
                    var that=this;
                    if (this.company_id3 != '') {
                        $.ajax({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                            },
                            type: 'post',
                            url: '/distribution/company-factory-type',
                            data: {
                                company_id:that.company_id3,
                            },
                            success: function (data) {
                                //console.log(data);
                                if(data.result.success){
                                    that.options4 = data.content;
                                }else{
                                    that.$notify.error({
                                        title: '提示',
                                        message: data.result.errorMsg,
                                    });
                                }
                            }
                        });
                    }else{
                        that.options4 =[];
                    }

                },
                /*按仓库汇总重置*/
                reset3(){
                    this.factory_type_id='';
                    this.grabble3('reset');
                },
                /*按仓库汇总每页条数*/
                handleSizeChange3(val) {
                    this.page3=val;
                    this.grabble3('reset');
                    //console.log(`每页 ${val} 条`);
                },
                /*按仓库汇总分页*/
                changePageSkip3(val){
                    //console.log(val);
                    this.currentPage3 = val;
                    this.grabble3();
                },
                /*按仓库汇总合计*/
                getSummaries3(param){
                    var that=this;
                    const { columns, data } = param;
                    const sums = [];
                    columns.forEach((column, index) => {
                        if (index === 0) {
                            sums[index] = '合计';
                            return;
                        }
                        switch (column.property) {
                            case 'existing_nums':
                                sums[index] = that.now_stock3;
                                break;
                            case 'user_nums':
                                sums[index] =that.available_num3;
                                break;
                            case 'occupied_num':
                                sums[index] = that.occupy_num3;
                                break;
                            case 'on_way_num':
                                sums[index] = that.way_num3;
                                break;
                            case 'count_nums':
                                sums[index] =that.total_num3;
                                break;
                            case 'existing_prices':
                                sums[index] =parseFloat(that.now_stock_price3).toFixed(2);
                                break;
                            case 'user_price':
                                sums[index] =parseFloat(that.available_price3).toFixed(2);
                                break;
                            case 'occupied_price':
                                sums[index] =parseFloat(that.occupy_price3).toFixed(2);
                                break;
                            case 'on_way_price':
                                sums[index] =parseFloat(that.way_price3).toFixed(2);
                                break;
                            case 'count_price':
                                sums[index] =parseFloat(that.total_price3).toFixed(2);
                                break;
                            default:
                                break;
                        }
                    });
                    return sums
                },
//------------------------------------
                /*按店明细列表*/
//                grabble4(type){
//                    var that = this;
////                    that.loading4=true;
//                    $.ajax({
//                        headers: {
//                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
//                        },
//                        type: 'post',
//                        url: 'https://www.easy-mock.com/mock/5bf4bcfb77b4ba288c1ed8ec/91dapin/getList',
//                        data: {
//                            company_id:that.company_id4,
//                            customer_id:that.shop_id4,
//                            type:4,
//                        },
//                        success: function (data) {
//                            console.log(data);
//                            if(data.result.success){
//                                var opt=[];
//                                for(let value of data.content.data){
//                                    that.idArr.push(value.id);
//                                    for(let val of value.category){
//                                        opt.push({
//                                            'shop':value.shop,
//                                            'id':value.id,
//                                            'brand':value.brand,
//                                            'cate_3':value.cate_3,
//                                            'girard':value.girard,
//                                            'color':value.color,
//                                            'size_group':value.size_group,
//                                            'year':value.year,
//                                            'season':value.season,
//                                            'retail_price':value.retail_price,
//                                            'type':val.type,
//                                            'num':val.num,
//                                        })
//                                    }
//                                }
//                                let cou=[];
//                                for(let vae of data.content.total){
//                                    cou.push({
//                                        'shop':'合计',
//                                        'brand':'-',
//                                        'cate_3':'-',
//                                        'girard':'-',
//                                        'color':'-',
//                                        'size_group':'-',
//                                        'year':'-',
//                                        'season':'-',
//                                        'cardCount':'-',
//                                        'type':vae.type,
//                                        'num':vae.num,
//                                    })
//                                }
//                                console.log(opt)
//                                console.log(cou)
//                                console.log(opt.concat(cou))
//                                let vRes=opt.concat(cou);
//
//                                that.shopDetail = vRes;
//                                that.loading4=false;
//
//                                let spanOneArr = [];
//                                let  concatOne = 0;
//                                vRes.forEach((item,index)=>{
//                                    if(index === 0){
//                                        spanOneArr.push(1);
//                                    }else{
//                                        if(item.shop === vRes[index - 1].shop){ //第一列需合并相同内容的判断条件
//                                            spanOneArr[concatOne] += 1;
//                                            spanOneArr.push(0);
//                                        }else{
//                                            spanOneArr.push(1);
//                                            concatOne = index;
//                                        }
//                                    }
//                                });
//                                that.spanArr=spanOneArr;
//                                //console.log(that.spanArr)
//                            }else{
//                                that.$notify({
//                                    title: '提示',
//                                    message: data.result.errorMsg,
//                                    duration: 0
//                                });
//                            }
//                        }
//                    });
//                },
                /*公司改变出店铺*/
//                change4(val){
//                    this.company_id4 = val;
//                    this.shop_id4='';
//                    var that=this;
//                    if (this.company_id4 != '') {
//                        $.ajax({
//                            headers: {
//                                'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
//                            },
//                            type: 'post',
//                            url: '/distribution/analysis-infos',
//                            data: {
//                                company_id:that.company_id4,
//                            },
//                            success: function (data) {
//                                if(data.result.success){
//                                    that.options2 = data.content.data;
//                                }else{
//                                    that.$notify.error({
//                                        title: '提示',
//                                        message: data.result.errorMsg,
//                                    });
//                                }
//                            }
//                        });
//                    }else{
//                        that.options2 =[];
//                    }
//
//                },
                /*按店明细重置*/
//                reset4(){
//                    this.shop_id4='';
//                    this.grabble4('reset');
//                },
                /*合并*/
//                objectSpanMethod4({ row, column, rowIndex, columnIndex }) {
//                    if (columnIndex ===  1 || columnIndex ===  2 || columnIndex ===  3 || columnIndex ===  4 || columnIndex ===  19 || columnIndex ===  20 || columnIndex ===  21 ) {
//                        // 合并第一列
//                        if (rowIndex % 4 === 0) {
//                            // 从第一行开始
//                            return {
//                                rowspan: 4,//行
//                                colspan: 1 //列
//                            };
//                        } else {
//                            return {
//                                rowspan: 0,
//                                colspan: 0
//                            };
//                        }
//                    }
//                    if(columnIndex === 0 ) {
//                        if(this.spanArr[rowIndex]){
//                            return {
//                                rowspan:this.spanArr[rowIndex],
//                                colspan:1
//                            }
//                        }else{
//                            return {
//                                rowspan: 0,
//                                colspan: 0
//                            }
//                        }
//                    }
//                },
//                rowClass({row, index}){
////                    console.log(row);
////                    var r=Math.floor(Math.random()*256);
////                    var g=Math.floor(Math.random()*256);
////                    var b=Math.floor(Math.random()*256);
////                    //return "rgb("+r+','+g+','+b+")";//所有方法的拼接都可以用ES6新特性`其他字符串{$变量名}`替换
////                    for (var i = 0; i < this.idArr.length; i++) {
////                        if (this.idArr.indexOf(this.idArr[i]) != i) {
////                            this.idArr.splice(i,1);//删除数组元素后数组长度减1后面的元素前移
////                            i--;//数组下标回退
////                        }
////                    }
////                    console.log(this.idArr);
////                    for(var x=0;x< this.idArr.length; x++){
////                        if(this.idArr[x]==row.id){
////                            return { "background-color": "rgb("+r+','+g+','+b+")","color":"#fff" }
////                        }
////                    }
////                    let colorArr=["#abcdef","#80ABBB","#35807D","#5EA77F","#A3E8A6"];
////                    item = colorArr[Math.floor(Math.random()*colorArr.length)];
////                    if(row.id==23){
////                        return { "background-color": item,"color":"#000" }
////                    }else if(row.id==32){
////                        return { "background-color": item,"color":"#000" }
////                    }
//                },
//-------------------------------------
                /*按款明细列表*/
                grabble5(type){
                    var that = this;
                    that.loading5=true;
                    let skip;
                    if(type == 'reset'){
                        skip = 0;
                    }else{
                        skip = that.currentPage5-1;
                    }
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/storage-analysis',
                        data: {
                            skip:skip,
                            page5:that.page5,
                            company_id:that.company_id5,
                            brand:that.brand5,
                            girard:that.girard5,
                            type:5,
                        },
                        success: function (data) {
                            console.log(data);
                            if(data.result.success){
                                var opt=[];
                                for(let value of data.content.data){
                                    for(let val of value.category){
                                        opt.push({
                                            'loop':value.loop,
                                            'brand':value.brand,
                                            'cate_3':value.cate_3,
                                            'girard':value.girard,
                                            'color':value.color,
                                            'size_group':value.size_group,
                                            'year':value.year,
                                            'quarter':value.quarter,
                                            'retail_price':value.retail_price,
                                            'type':val.type,
                                            'num':val.num,
                                        })
                                    }
                                }
                                let cou=[];
                                for(let vae of data.content.total){
                                    cou.push({
                                        'brand':'-',
                                        'cate_3':'-',
                                        'girard':'合计',
                                        'color':'-',
                                        'size_group':'-',
                                        'year':'-',
                                        'quarter':'-',
                                        'retail_price':'-',
                                        'type':vae.type,
                                        'num':vae.num,
                                    })
                                }
                                //let vRes=opt.concat(cou);
                                //that.shopGirard = vRes;
                                that.shopGirard = opt;
                                that.huiZong5=cou;
                                that.currentPage5 = data.content.skip;
                                that.total5 = data.content.total_count;
                                that.loading5=false;

                                let spanOneArr5 = [];
                                let  concatOne5 = 0;
                                opt.forEach((item,index)=>{
                                    if(index === 0){
                                        spanOneArr5.push(1);
                                    }else{
                                        if(item.girard === opt[index - 1].girard){ //第一列需合并相同内容的判断条件
                                            spanOneArr5[concatOne5] += 1;
                                            spanOneArr5.push(0);
                                        }else{
                                            spanOneArr5.push(1);
                                            concatOne5 = index;
                                        }
                                    }
                                });
                                that.spanArr5=spanOneArr5;
                                //console.log(that.spanArr5)
                            }else{
                                that.$notify({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                    duration: 0
                                });
                            }
                        }
                    });
                },
                /*汇总合并*/
                huiZongMethod5({ row, column, rowIndex, columnIndex }){
                    if (columnIndex ===  0 || columnIndex ===  1 || columnIndex ===  2 || columnIndex ===  3 || columnIndex ===  5 || columnIndex ===  18 || columnIndex ===  19 || columnIndex ===  20 ) {
                        // 合并第一列
                        if (rowIndex % 4 === 0) {
                            // 从第一行开始
                            return {
                                rowspan: 4,//行
                                colspan: 1 //列
                            };
                        } else {
                            return {
                                rowspan: 0,
                                colspan: 0
                            };
                        }
                    }
                },
                /*远程搜索*/
                querySearchAsync5(queryString, cb) {
                    var that=this;
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/designwarehouse-girards',
                        data: {
                            girard:queryString
                        },
                        success: function (data) {
                            if(data.result.success){
                                var results=[];
                                for(var i=0;i<data.content.length;i++){
                                    results.push({
                                        'value':data.content[i]
                                    })
                                }
                                clearTimeout(this.timeout);
                                this.timeout = setTimeout(() => {
                                    cb(results);
                                }, 1000 * Math.random());
                                $(".el-autocomplete-suggestion.el-popper.is-loading").show();
                            }else{
                                that.$notify.error({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                });
                            }
                        }
                    });
                },
                /*公司改变出品牌*/
                change5(val){
                    this.company_id5 = val;
                    this.brand5='';
                    var that=this;
                    if (this.company_id5 != '') {
                        $.ajax({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                            },
                            type: 'post',
                            url: '/distribution/analysis-infos',
                            data: {
                                company_id:that.company_id5,
                                brand:-1,
                            },
                            success: function (data) {
                                // console.log(data);
                                if(data.result.success){
                                    that.options5 = data.content.data;
                                }else{
                                    that.$notify.error({
                                        title: '提示',
                                        message: data.result.errorMsg,
                                    });
                                }
                            }
                        });
                    }else{
                        that.options3 =[];
                    }

                },
                /*按款明细重置*/
                reset5(){
                    this.brand5='';
                    this.girard5='';
                    this.grabble5('reset');
                },
                /*按款明细每页条数*/
                handleSizeChange5(val) {
                    this.page5=val;
                    this.grabble5('reset');
                    //console.log(`每页 ${val} 条`);
                },
                /*按款明细分页*/
                changePageSkip5(val){
                    //console.log(val);
                    this.currentPage5 = val;
                    this.grabble5();
                },
                /*合并*/
                objectSpanMethod5({ row, column, rowIndex, columnIndex }) {
                    if (columnIndex ===  1 || columnIndex ===  2 || columnIndex ===  3 || columnIndex ===  18 || columnIndex ===  19 || columnIndex ===  20 ) {
                        // 合并第一列
                        if (rowIndex % 4 === 0) {
                            // 从第一行开始
                            return {
                                rowspan: 4,//行
                                colspan: 1 //列
                            };
                        } else {
                            return {
                                rowspan: 0,
                                colspan: 0
                            };
                        }
                    }
                    if(columnIndex === 0 ) {
                        if(this.spanArr5[rowIndex]){
                            return {
                                rowspan:this.spanArr5[rowIndex],
                                colspan:1
                            }
                        }else{
                            return {
                                rowspan: 0,
                                colspan: 0
                            }
                        }
                    }
                },
                /*汇总合并*/
                huiZongMethod5({ row, column, rowIndex, columnIndex }){
                    if (columnIndex ===  0 || columnIndex ===  1 || columnIndex ===  2 || columnIndex ===  3 || columnIndex ===  5 || columnIndex ===  18 || columnIndex ===  19 || columnIndex ===  20 ) {
                        // 合并第一列
                        if (rowIndex % 4 === 0) {
                            // 从第一行开始
                            return {
                                rowspan: 4,//行
                                colspan: 1 //列
                            };
                        } else {
                            return {
                                rowspan: 0,
                                colspan: 0
                            };
                        }
                    }
                },
                rowClass5({row, index}){
                    if(row.loop % 2 === 0){
                        return {"color":"#cd6ade" }
                    }else if(row.loop % 2 === 1){
                        return {"color":"#4147ff" }
                    }
                },
//--------------------------------------
                /*按仓库明细列表*/
                grabble6(type){
                    var that = this;
                    that.loading6=true;
                    let skip;
                    if(type == 'reset'){
                        skip = 0;
                    }else{
                        skip = that.currentPage6-1;
                    }
                    $.ajax({
                        headers: {
                            'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                        },
                        type: 'post',
                        url: '/distribution/storage-analysis',
                        data: {
                            skip:skip,
                            page6:that.page6,
                            company_id:that.company_id6,
                            factory_type_id:that.factory_type_id6,
                            type:6,
                        },
                        success: function (data) {
                            console.log(data);
                            if(data.result.success){
                                var opt=[];
                                for(let value of data.content.data){
                                    for(let val of value.category){
                                        opt.push({
                                            'loop':value.loop,
                                            'factory_type':value.factory_type,
                                            'brand':value.brand,
                                            'cate_3':value.cate_3,
                                            'girard':value.girard,
                                            'color':value.color,
                                            'size_group':value.size_group,
                                            'year':value.year,
                                            'quarter':value.quarter,
                                            'retail_price':value.retail_price,
                                            'type':val.type,
                                            'num':val.num,
                                        })
                                    }
                                }
                                let cou=[];
                                for(let vae of data.content.total){
                                    cou.push({
                                        'factory_type':'合计',
                                        'brand':'-',
                                        'cate_3':'-',
                                        'girard':'-',
                                        'color':'-',
                                        'size_group':'-',
                                        'year':'-',
                                        'quarter':'-',
                                        'retail_price':'-',
                                        'type':vae.type,
                                        'num':vae.num,
                                    })
                                }
                                //let vRes=opt.concat(cou);
                                //that.shopHouse = vRes;
                                that.shopHouse =opt;
                                that.huiZong6=cou;
                                that.currentPage6 = data.content.skip;
                                that.total6 = data.content.total_count;

                                that.loading6=false;

                                let spanOneArr6 = [];
                                let  concatOne6 = 0;
                                opt.forEach((item,index)=>{
                                    if(index === 0){
                                        spanOneArr6.push(1);
                                    }else{
                                        if(item.factory_type === opt[index - 1].factory_type){ //第一列需合并相同内容的判断条件
                                            spanOneArr6[concatOne6] += 1;
                                            spanOneArr6.push(0);
                                        }else{
                                            spanOneArr6.push(1);
                                            concatOne6 = index;
                                        }
                                    }
                                });
                                that.spanArr6=spanOneArr6;
                                //console.log(that.spanArr6)
                            }else{
                                that.$notify({
                                    title: '提示',
                                    message: data.result.errorMsg,
                                    duration: 0
                                });
                            }
                        }
                    });
                },
                /*公司改变出仓库*/
                change6(val){
                    this.company_id6 = val;
                    this.factory_type_id6='';
                    var that=this;
                    if (this.company_id6 != '') {
                        $.ajax({
                            headers: {
                                'X-CSRF-TOKEN': $('meta[name="csrf_token"]').attr('content')
                            },
                            type: 'post',
                            url: '/distribution/company-factory-type',
                            data: {
                                company_id:that.company_id6,
                            },
                            success: function (data) {
                                //console.log(data);
                                if(data.result.success){
                                    that.options6 = data.content;
                                }else{
                                    that.$notify.error({
                                        title: '提示',
                                        message: data.result.errorMsg,
                                    });
                                }
                            }
                        });
                    }else{
                        that.options4 =[];
                    }

                },
                /*按仓库明细重置*/
                reset6(){
                    this.factory_type_id6='';
                    this.grabble6('reset');
                },

                /*按仓库明细每页条数*/
                handleSizeChange6(val) {
                    this.page6=val;
                    this.grabble6('reset');
                    //console.log(`每页 ${val} 条`);
                },
                /*按仓库明细分页*/
                changePageSkip6(val){
                    //console.log(val);
                    this.currentPage6 = val;
                    this.grabble6();
                },
                /*合并*/
                objectSpanMethod6({ row, column, rowIndex, columnIndex }) {
                    if (columnIndex ===  1 || columnIndex ===  2 || columnIndex ===  3 || columnIndex ===  4 || columnIndex ===  19 || columnIndex ===  20 || columnIndex ===  21 ) {
                        // 合并第一列
                        if (rowIndex % 4 === 0) {
                            // 从第一行开始
                            return {
                                rowspan: 4,//行
                                colspan: 1 //列
                            };
                        } else {
                            return {
                                rowspan: 0,
                                colspan: 0
                            };
                        }
                    }
                    if(columnIndex === 0 ) {
                        if(this.spanArr6[rowIndex]){
                            return {
                                rowspan:this.spanArr6[rowIndex],
                                colspan:1
                            }
                        }else{
                            return {
                                rowspan: 0,
                                colspan: 0
                            }
                        }
                    }
                },
                /*汇总合并*/
                huiZongMethod6({ row, column, rowIndex, columnIndex }){
                    if (columnIndex ===  0 || columnIndex ===  1 || columnIndex ===  2 || columnIndex ===  3 || columnIndex ===  4 || columnIndex ===  6 || columnIndex ===  19 || columnIndex ===  20 || columnIndex ===  21 ) {
                        // 合并第一列
                        if (rowIndex % 4 === 0) {
                            // 从第一行开始
                            return {
                                rowspan: 4,//行
                                colspan: 1 //列
                            };
                        } else {
                            return {
                                rowspan: 0,
                                colspan: 0
                            };
                        }
                    }
                },
                rowClass6({row, index}){
                    if(row.loop % 2 === 0){
                        return {"color":"#cd6ade" }
                    }else if(row.loop % 2 === 1){
                        return {"color":"#4147ff" }
                    }
                },




                handleClick(tab, event) {
                    if(tab.name=='first'){
                        this.grabble1('reset');
                    }else if(tab.name=='second'){
                        this.grabble2('reset');
                    }else if(tab.name=='third'){
                        this.grabble3('reset');
                    }else if(tab.name=='fourth'){
                        this.grabble4('reset');
                    }else if(tab.name=='fifth'){
                        this.grabble5('reset');
                    }else if(tab.name=='sixth'){
                        this.grabble6('reset');
                    }
                },
            },
            watch : {
                /*款号字母大写*/
                girard:function(val) {
                    this.girard = val.toUpperCase();
                },
                girard5:function(val) {
                    this.girard5 = val.toUpperCase();
                },
            }
        });
    </script>
@endsection
